import Geometry from "./geometry";
import CONSTANT from "../constant";
import GjkEpa from "../collision-detector/gjk-epa-detector/gjk-epa";

export default class ConvexGeometry extends Geometry{
    constructor(type) {
        super(type);
        this._gjkMargin =CONSTANT.SETTING_DEFAULT_GJK_MARGIN;
        this._useGjkRayCast = false;
    }
    get gjkMargin() {
        return this._gjkMargin;
    }
    set gjkMargin(gjkMargin) {
        this._gjkMargin = gjkMargin<0?0:gjkMargin;
    }
    computeLocalSupportingVertex(dir,out) {
    }
    rayCast(begin,end,transform,hit) {
        if(this._useGjkRayCast) {
            return GjkEpa.instance.rayCast(this,transform,begin,end,hit);
        } else {
            return super.rayCast(begin,end,transform,hit);
        }
    }
}